using System;
using System.ComponentModel;
using System.Drawing;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	
	[Serializable()]
	[XmlType(TypeName = "ListStyleType")]
	public class ListStyle : ObjectType
	{
		private ListItemTypeEnum listItemTypeField;
		private KMLColor bgColorField;
        private ItemIcon[] itemIconField;

		public ListStyle()
		{
			this.bgColorField = new KMLColor("ffffffff");
		}

		[XmlIgnore()]
		public Color BackgroundColor
		{
            get { return this.bgColorField.Color; }
			set { this.bgColorField = new KMLColor(value); }
		}
        [XmlElement(ElementName = "bgColor", DataType = "hexBinary", Type = typeof(byte[]))]
		public byte[] BackgroundColorComponents
		{
			get { return this.bgColorField.ToByteArray(); }
			set { this.bgColorField = new KMLColor(value); }
		}

		[XmlElement(ElementName = "listItemType", Type = typeof(ListItemTypeEnum))]
		[DefaultValue(ListItemTypeEnum.Check)]
		public ListItemTypeEnum ListItemType
		{
			get { return this.listItemTypeField; }
			set { this.listItemTypeField = value; }
		}

        [System.Xml.Serialization.XmlElementAttribute("ItemIcon")]
        public ItemIcon[] ItemIcon
        {
            get { return this.itemIconField; }
            set { this.itemIconField = value; }
        }
	}
  

    [Serializable()]
    [XmlType(TypeName = "ItemIcon")]
    public class ItemIcon : ObjectType
    {
        private string hrefField;
        private ItemIconStateEnum stateField;

        [XmlElement(ElementName = "href", DataType = "anyURI")]
        public string Href
        {
            get { return this.hrefField; }
            set { this.hrefField = value; }
        }

        [System.Xml.Serialization.XmlElementAttribute("state")]
        public ItemIconStateEnum state
        {
            get { return this.stateField; }
            set { this.stateField = value; }
        }
    }

    [Serializable()]
    [XmlType(TypeName = "listItemTypeEnum")]
    public enum ListItemTypeEnum
    {
        [XmlEnum(Name = "radioFolder")]
        RadioFolder,

        [XmlEnum(Name = "check")]
        Check,

        [XmlEnum(Name = "checkHideChildren")]
        CheckHideChildren,

        [XmlEnum(Name = "checkOffOnly")]
        CheckOffOnly
    }


    [Serializable()]
    [XmlType(TypeName = "itemIconStateEnum")]
    public enum ItemIconStateEnum
    {
        [XmlEnum(Name = "open")]
        Open,

        [XmlEnum(Name = "closed")]
        Closed,

        [XmlEnum(Name = "error")]
        Error,

        [XmlEnum(Name = "fetching0")]
        Fetching0,

        [XmlEnum(Name = "fetching1")]
        Fetching1,

        [XmlEnum(Name = "fetching2")]
        Fetching2
    }
}